package com.fairytask.ui.guide
{
	import com.fairytask.engine.components.button.Button;
	import com.fairytask.engine.components.text.Text;
	import com.fairytask.engine.define.ColorDefine;
	import com.fairytask.engine.resource.StaticIni;
	import com.jzonl.logic.GuideLogic;
	import com.jzonl.net.messages.CustomToServerFlag;
	import com.jzonl.net.mgr.NetMgr;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	
	/**
	 *对应的具有按钮的选择框 
	 */
	public class GuideInfoUI extends BaseGuide
	{
		private static var instance	:GuideInfoUI;
		
		//显示
		public var guideBg		:MovieClip;
		public var guideTxt	:Text;
		public var confirmBtn	:Button;
		public var cancelBtn	:Button;
		
		public static function getInstance():GuideInfoUI
		{
			if(instance==null)
			{
				instance	=	new GuideInfoUI();
			}
			return instance;
		}
		
		public function GuideInfoUI(popupUI:Boolean=true)
		{
			initEvent();
		}
		
		override public function initGUI():void
		{
			guideBg.width	=	200;
			guideBg.height	=	150;
			
			guideTxt.color	=	ColorDefine.GUIDEHIGHTLISHT;
		}
		
		private function initEvent():void
		{
			//组件消息
			confirmBtn.addEventListener(MouseEvent.CLICK, hideGuid);
			cancelBtn.addEventListener(MouseEvent.CLICK, cancelGuid);
		}
		
		/**
		 * 取消引导 
		 * @param evt
		 * 
		 */
		private function cancelGuid(evt:MouseEvent):void
		{
			this.hide();
			//NetMgr.sendCustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_FRESHMAN_CANCEL);
		}
		
		override public function showGuide(txt:String,descTxt:String="",pType:int=-1):void
		{
			guideTxt.htmlStr	=	StaticIni.getSwfLangStr(txt);
			super.showGuide(txt,descTxt);

				cancelBtn.visible	=	true;
				confirmBtn.x	=	31;
				cancelBtn.x		=	91;
				confirmBtn.label=	StaticIni.getSwfLangStr("4002001256");

	
				cancelBtn.visible	=	false;
				confirmBtn.x	=	61;
				confirmBtn.label=	StaticIni.getSwfLangStr("4002000119");
		}
		
		public function hideGuid(evt:MouseEvent):void
		{
			super.onOKCancel(evt);
			this.hide();	
		}
	}
}